package com.suredy.app.plan.model;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.suredy.core.model.BaseFlowModel;

@Entity
@Table(name = "T_APP_PLAN")
public class PlanInfo extends BaseFlowModel{
	
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date planDate;
	private Integer status=0;
	private String title;
	
	@OneToMany(mappedBy = "planInfo", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@OrderBy("placeId")
	private Set<PlanPlace> planItems;
	
	
	@OneToMany(mappedBy = "planInfo", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@OrderBy("testCode")
	private Set<PlanTestItem> testItems;
	
	public Date getPlanDate() {
		return planDate;
	}

	public void setPlanDate(Date planDate) {
		this.planDate = planDate;
	}

	public Integer getStatus() {
		return status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	
	
	public Set<PlanPlace> getPlanItems() {
		return planItems;
	}

	public void setPlanItems(Set<PlanPlace> planItems) {
		this.planItems = planItems;
	}


	
	public Set<PlanTestItem> getTestItems() {
		return testItems;
	}

	
	public void setTestItems(Set<PlanTestItem> testItems) {
		this.testItems = testItems;
	}

	@Transient
	public String getTitle() {
		return title;
	}


	
	public void setTitle(String title) {
		this.title = title;
	}
	
	
}
